<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('选择用户')" />
</head>

<body class="gray-bg">
	<input id="caseNo"   name="caseNo"    type="hidden" />
	<input id="caseName" name="caseName"  type="hidden" />
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="role-form">
					<div class="select-list">
						 <ul>
                            <li>
                                <label>案由名称：</label>
                                <input type="text" name="caseName"/>
                            </li>
                            <li>
                                <label>案件类型：</label>
                                <input type="text" name="caseTypeId"/>
                            </li>
                            <li>
                                <label>诉讼类型：</label>
                                <input type="text" name="litigateTypeId"/>
                            </li>
                            <li>
                                <label>状态：</label>
                                <select name="status">
				                    <option value="">所有</option>
					      			<option th:each="u:${caseStatus}" th:text="${u.name}" th:value="${u.id}" 
					      			  </option>
					   			</select>
                            </li>
                            <li>
                                <label>审批人：</label>
                                <input type="text" name="checkUserName"/>
                            </li>
                            <li>
                                <label>审批状态：</label>
                                <select name="checkStatus">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
                        </ul>
					</div>
				</form>
			</div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		var datas = [[${@dict.getType('sys_normal_disable')}]];
        var prefix = ctx + "biz/caseinfo/inquiry";

		$(function() {
			var options = {
		        url: prefix + "/query",
		        queryParams: queryParams,
		        sortName: "createTime",
		        sortOrder: "desc",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
		        clickToSelect: true,
		        rememberSelected: true,
		        columns: [{
                    /* checkbox: true */
                    radio: true
		        },
                {
                    field: 'caseId',
                    title: '案件ID',
                    visible: true
                },
                {
                    field: 'caseNo',
                    title: '案件编号'
                },
                {
                    field: 'caseName',
                    title: '案由名称'
                },
                {
                    field: 'caseTypeName',
                    title: '案件类型'
                },
                {
                    field: 'litigateTypeName',
                    title: '诉讼类型'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                    	if (row.status==0) {
                        	return "已登记";
                        } else if (row.status==1) {
                        	return "已立案";
                    	} else if (row.status==2) {
                        	return "进行中";
                    	} else if (row.status==3) {
                        	return "已结案";
                    	} else if (row.status==4) {
                        	return "已归档";
                        } else {
                        	return "初始化";
                        }
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'checkBy',
                    title: '审批人'
                },
                {
                    field: 'checkStatus',
                    title: '审批',
                    formatter: function(value, row, index) {
                        if (row.checkStatus==1) {
                        	return "已审";
                        /* } else if (row.checkStatus==1) {
                        	return "待结案"; */
                        } else {
                        	return "未审";
                        }
                    }
                },
		        {
		            field: 'createTime',
		            title: '创建时间',
		            sortable: true
		        }
		        ]
		    };
		    $.table.init(options);
		});
		
		function queryParams(params) {
			var search = $.table.queryParams(params);
			return search;
		}
		
		/* 添加用户-选择用户-提交 */
		function submitHandler() {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		} else if (rows.length>1) {
       			$.modal.alertWarning("请选择一条记录");
       			return;
       		} else {
	   			var rowsData = $('#bootstrap-table').bootstrapTable('getSelections');
	   			var row = rowsData[0];
	   			$("#caseNo").val(row.caseNo);
	   			$("#caseName").val(row.caseName);
       		}
		}
		
		$("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
            var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
   			var row = rows;
   			$("#caseNo").val(row.caseNo);
   			$("#caseName").val(row.caseName);
            //var rowIds = $.table.affectedRowIds(rows);
            //$("#rowIds").val(rowIds);
        });

	</script>
</body>
</html>